﻿CREATE TABLE [dbo].[Product] (
    [Id]           UNIQUEIDENTIFIER CONSTRAINT [DF_Product_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
    [IsActive]     BIT              NOT NULL,
    [DateAdded]    DATETIME2 (7)    NOT NULL,
    [DateUpdated]  DATETIME2 (7)    NOT NULL,
    [Name]         NVARCHAR (200)   NOT NULL,
    [Manufacturer] UNIQUEIDENTIFIER NULL,
    [Category]     UNIQUEIDENTIFIER NULL,
    [Amount]       INT              NULL,
    [AmountUnit]   UNIQUEIDENTIFIER NULL,
    [Quantity]     INT              NULL,
    [QuantityUnit] UNIQUEIDENTIFIER NULL,
    CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_Product_ProductAmountUnit] FOREIGN KEY ([AmountUnit]) REFERENCES [dbo].[ProductAmountUnit] ([Id]),
    CONSTRAINT [FK_Product_ProductCategory] FOREIGN KEY ([Category]) REFERENCES [dbo].[ProductCategory] ([Id]),
    CONSTRAINT [FK_Product_ProductMaker] FOREIGN KEY ([Manufacturer]) REFERENCES [dbo].[ProductMaker] ([Id]),
    CONSTRAINT [FK_Product_ProductQuantityUnit] FOREIGN KEY ([QuantityUnit]) REFERENCES [dbo].[ProductQuantityUnit] ([Id])
);

